package com.hengpeng.itfinbase.persist;

import java.util.Date;
import java.util.Map;

import javax.persistence.Column;
import javax.persistence.ElementCollection;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.Id;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.hengpeng.common.persist.entity.AbstractEntity;
import com.hengpeng.common.web.annotation.HtmlInput;
import com.hengpeng.common.web.annotation.HtmlInputPattern;
import com.hengpeng.common.web.annotation.HtmlInputType;

/**
 * 短信合作商信息表
 * @author zhaojitao
 * @version 20150514
 */
@Entity
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class SmsPartner extends AbstractEntity
{
	/**
	 * <pre>
	 * 合作商状态
	 * </pre>
	 * @author zhaojitao
	 * @version 1.0, 2011-8-16
	 */
	public static enum SmsPartnerStatus
	{
		/**
		 * 关闭
		 */
		CLOSED("关闭"),
		/**
		 * 打开
		 */
		OPEN("打开");

		private String text;

		SmsPartnerStatus(String text)
		{
			this.text = text;
		}

		public String getText()
		{
			return text;
		}

		public void setText(String text)
		{
			this.text = text;
		}
	}

	/**
	 * <pre>
	 * 短信发送终端类型
	 * </pre>
	 * @author chenjian
	 * @version 1.0, 2012-10-11
	 */
	public static enum SmsSendType
	{
		HSAP("恒朋短信接口");

		private String text;

		SmsSendType(String text)
		{
			this.text = text;
		}

		public String getText()
		{
			return text;
		}

		public void setText(String text)
		{
			this.text = text;
		}
	}

	private static final long serialVersionUID = 1933860213831072480L;

	/**
	 * 合作商创建时间
	 */
	@HtmlInput(label = "创建时间", type = HtmlInputType.LABEL, index = 6, nullable = true)
	private Date createTime;

	@Id
	@Column(length = 20)
	@HtmlInput(label = "编号", maxLength = 20, type = HtmlInputType.ID, index = 1, nullable = false)
	private Long id;

	@Column(length = 20)
	@HtmlInput(label = "密钥", maxLength = 20, type = HtmlInputType.TEXT, index = 2, nullable = false)
	private String secretKey;

	@Column(length = 20)
	@HtmlInput(label = "名称", maxLength = 20, type = HtmlInputType.TEXT, index = 3, nullable = true)
	private String name;

	@HtmlInput(label = "描述", type = HtmlInputType.TEXTAREA, index = 30, nullable = false)
	private String remark;

	@Column(length = 20)
	@HtmlInput(label = "分配的商户编号", maxLength = 20, type = HtmlInputType.TEXT, index = 2, nullable = false)
	private String partnerId;

	@ElementCollection(fetch = FetchType.EAGER)
	@HtmlInput(label = "短信商户配置信息", maxLength = 500, type = HtmlInputType.TEXTAREA, tips = "格式:{a=1,b=2}", index = 99, nullable = true, inputId = "extConfigString")
	private Map<String, String> extConfigs;

	@Column(length = 10)
	@HtmlInput(label = "发送优先级", maxLength = 10, type = HtmlInputType.TEXT, index = 5, nullable = false, pattern = HtmlInputPattern.INT)
	private Integer priority;

	/**
	 * 短信终端类型
	 */
	@Column(length = 20)
	@Enumerated(javax.persistence.EnumType.STRING)
	@HtmlInput(label = "终端类型", type = HtmlInputType.SELECT, index = 4, nullable = false, labelProperty = "text")
	private SmsSendType smsSendType;

	/**
	 * 合作商状态
	 */
	@Column(length = 10)
	@Enumerated(javax.persistence.EnumType.STRING)
	@HtmlInput(label = "状态", type = HtmlInputType.SELECT, index = 4, nullable = false, labelProperty = "text")
	private SmsPartnerStatus status;

	public Date getCreateTime()
	{
		return createTime;
	}

	public Long getId()
	{
		return id;
	}

	public String getName()
	{
		return name;
	}

	public String getPartnerId()
	{
		return partnerId;
	}

	public Integer getPriority()
	{
		return priority;
	}

	public SmsSendType getSmsSendType()
	{
		return smsSendType;
	}

	public SmsPartnerStatus getStatus()
	{
		return status;
	}

	public void setCreateTime(Date createTime)
	{
		this.createTime = createTime;
	}

	public void setId(Long id)
	{
		this.id = id;
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public void setPartnerId(String partnerId)
	{
		this.partnerId = partnerId;
	}

	public void setPriority(Integer priority)
	{
		this.priority = priority;
	}

	public void setSmsSendType(SmsSendType smsSendType)
	{
		this.smsSendType = smsSendType;
	}

	public void setStatus(SmsPartnerStatus status)
	{
		this.status = status;
	}

	public Map<String, String> getExtConfigs()
	{
		return extConfigs;
	}

	public void setExtConfigs(Map<String, String> extConfigs)
	{
		this.extConfigs = extConfigs;
	}

	public String getRemark()
	{
		return remark;
	}

	public void setRemark(String remark)
	{
		this.remark = remark;
	}

	public String getSecretKey()
	{
		return secretKey;
	}

	public void setSecretKey(String secretKey)
	{
		this.secretKey = secretKey;
	}

	
}
